#pragma once
#include "afxwin.h"
#include "Framework\MainFrm.h"
#include "Framework\ChildFrm.h"

class CLego_3Dview;
class CLego_3Ddoc;

// CDLG_2DSpline dialog
class CDLG_2DSpline_Setting : public CDialog
{
	DECLARE_DYNAMIC(CDLG_2DSpline_Setting)

public:
	CDLG_2DSpline_Setting(CWnd* pParent = NULL);   
	CDLG_2DSpline_Setting(CLego_3Dview *pView);
	virtual ~CDLG_2DSpline_Setting();
	CLego_3Dview* GetMainView(void);
	BOOL Create(void);
	void Re_display();

protected:
	virtual void DoDataExchange(CDataExchange* pDX);   
	virtual BOOL OnInitDialog();
	virtual void OnOK();

	// Dialog Data
	enum { IDD = IDD_DLG_2D_SPLINE_SETTING };
private: 
	CLego_3Dview	*m_pView;
	CLego_3Ddoc		*m_pDoc;
	HINSTANCE		m_hInstance;
	HACCEL			m_hAccelerator; 	
	BOOL PreTranslateMessage(MSG* pMsg);
public:
	//input
	CButton CheckControlInputSpline;
	CButton CheckControlInputPoly;
	//sample
	CSliderCtrl m_SliderSample;
	CButton CheckControlKeepOriginV;
	bool	m_bOnlyIncrease;
	CEdit   EditControlSample;
	int		m_nVertexNum;
	//display
	CButton CheckControlShowSpline;
	bool	m_bShowSpline;
	CButton CheckControlShowSplineCurve;
	bool	m_bShowSplineCurve;
	CButton CheckControlShowSplineVertex;
	bool	m_bShowSplineVertex;
	CButton CheckControlShowSplineVertexIndex;
	bool	m_bShowSplineVertexIndex;
	CButton CheckControlShowSplineColorLine;
	bool	m_bShowSplineColorLine;
	CButton CheckControlShowNormal;
	bool	m_bShowNormal;
	//show in mesh view
	CButton CheckControlShowInMeshView;
	bool	m_bShowInMeshView;
	CEdit   EDTTriAvgArea;
	void UpdateSampleRate(void);
	std::vector<int> m_holeSet;
	CButton CHKAddFrameAsBorder;
//message
	DECLARE_MESSAGE_MAP()
	afx_msg void OnBnClickedOk();
	afx_msg void OnCancel();
	afx_msg void OnButtonClickRatioInputSpline();
	afx_msg void OnBnClickedCheckShowSpline();
	afx_msg void OnBnClickedRadioInputPoly();
	afx_msg void OnBnClickedButtonSplineSelect();
	afx_msg void OnBnClickedButtonSplineModify();
	afx_msg void OnBnClickedCheckShowSplineVertex();
	afx_msg void OnBnClickedCheckShowSplineVertexIndex();
	afx_msg void OnBnClickedCheckShowColorline();
	afx_msg void OnBnClickedButton2dsplineSave();
	afx_msg void OnBnClickedButton2dsplineLoad();
	afx_msg void OnBnClickedButton2dsplineDelete();
	afx_msg void OnBnClickedButton2dsplineAddFromfile();
	afx_msg void OnBnClickedButton2dsplineSelectall();
	afx_msg void OnBnClickedCheckShowSplineInMeshView();
	afx_msg void OnBnClickedCheckShowSplineNormal();
	afx_msg void OnBnClickedButton2dsplineReverseOrder();
	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
	afx_msg void OnBnClickedCheck2dsplineKeepOriginVertex();
	afx_msg void OnBnClickedCheckShowSplineCurve();
	afx_msg void OnBnClickedButton2dsplineCloseUnclose();
	//afx_msg void OnBnClickedButton2dsplineTriangulation();
	afx_msg void OnBnClickedButton2dsplineSetHolesForTrig();
};
